function isSame(s1, s2, exact = []) {
	s1 = new Set([...s1, ...exact]);
	s2 = new Set([...s2, ...exact]);
	const totalSet = new Set([...s1, ...s2]);
	return !(s1.size !== s2.size || totalSet.size !== s1.size || totalSet.size !== s2.size);
	
}

function arraify(obj, key) {
	if (!obj[key]) {
		obj[key] = [];
	}
	if (!Array.isArray(obj[key])) {
		obj[key] = [obj[key]];
	}
}

function XOR(s1, s2, exact = []) {
	const set1 = new Set([...s1, ...exact]);
	const set2 = new Set([...s2, ...exact]);
	const totalSet = new Set([...s1, ...s2]);
	for (const s of [...set1]) {
		if (set2.has(s)) {
			set2.delete(s);
			set1.delete(s);
		}
	}
	for (const s of [...set2]) {
		if (set1.has(s)) {
			set1.delete(s);
			set2.delete(s);
		}
	}
	return [[...set1], [...set2]];
}

module.exports = {
	isSame, arraify, XOR
}
